#ifndef MESSAGESHOWAREA_H
#define MESSAGESHOWAREA_H

#include <QObject>
#include <QScrollArea>
#include <QLabel>
#include "model/data.h"

using model::Message;

class MessageShowArea : public QScrollArea
{
    Q_OBJECT
public:
    MessageShowArea();
    void addMessage(bool isLeft,const Message& message);
    void insertMessage(bool isLeft, const Message& message);
    void clear();
private:
    QWidget* container;
};

class MessageItem : public QWidget
{
    Q_OBJECT
public:
    MessageItem(bool isLeft);
    static MessageItem* makeMessageItem(bool isLeft, const Message& message);
    static QWidget* makeTextMessageItem(bool isLeft, const QString& text);
private:
    bool isLeft;
};


class MessageContentLabel :public QWidget
{
public:
    MessageContentLabel(const QString& text, bool isLeft);

    void paintEvent(QPaintEvent *event);
private:
    QLabel* label;
    bool isLeft;
};



#endif // MESSAGESHOWAREA_H
